<!--
 * @Description: 
 * @Version: 2.0
 * @Autor: wsh
 * @Date: 2023-06-20 10:13:27
 * @LastEditors: wsh
 * @LastEditTime: 2023-06-20 10:19:33
-->
<template>
  <BaseContainer>
    <aplid-base-crud ref="crud" class="w-100" v-bind="baseConfig">
      <template v-slot:ReportDialog="{ row, show }">
        <Detail
          @rechange="handleOperate"
          @refresh="handleRefresh"
          :api="baseConfig.api"
          :key="show"
          :nowRowData="row">
        </Detail>
      </template>
      <template v-slot:AssessDialog="{ row, show }">
        <Assess 
          @rechange="handleOperate"
          @refresh="handleRefresh"
          :api="baseConfig.api"
          :key="show"
          :nowRowData="row">
        </Assess>
      </template>
      <template v-slot:DetailDialog="{ row, show }">
        <Assess 
          @rechange="handleOperate"
          @refresh="handleRefresh"
          :api="baseConfig.api"
          :is-disable="true"
          :key="show"
          :nowRowData="row">
        </Assess>
      </template>
      <template v-slot:starRating="{ row }">
        <el-rate
        v-model="row.starRating"
        disabled
        show-score
        text-color="#ff9900"
        score-template="{value} 级"
      />
      </template>
    </aplid-base-crud>
  </BaseContainer>
</template>

<script setup lang="ts">

import { baseConfig } from './config'
import Detail from './Detail/index.vue'
import Assess from './Assess/index.vue'

const crud = ref()
const handleRefresh = () => {
  nextTick(() => {
    crud.value.refreshChange()
  })
}

const handleOperate = (type, row, title) => {
  nextTick(() => {
    crud.value.handleOperate(type, row, title)
  })
}
</script>

<style scoped></style>